//
// Created by 16933 on 2022/5/1.
//

#include "bsp_vofa.h"
float fdata[3];
unsigned char tail[4] = {0x00, 0x00, 0x80, 0x7f};
void JustFloat_Imu(UART_HandleTypeDef *huart,float*  pitch,float * roll,float *yaw)
{
    fdata[0] = *pitch;
    fdata[1] = *roll;
    fdata[2] = *yaw;
    HAL_UART_Transmit_DMA(huart,(uint8_t*) fdata,sizeof(float)*3);
    while (!__HAL_UART_GET_FLAG(&huart2,UART_FLAG_TC))
    {
        ;
    }
    HAL_UART_Transmit_DMA(huart,(uint8_t*)tail,4);
    while (!__HAL_UART_GET_FLAG(&huart2,UART_FLAG_TC))
    {
        ;
    }
}

void FireWater_Imu(UART_HandleTypeDef *huart,float*  pitch,float * roll,float *yaw)
{
    HAL_UART_Transmit_DMA(huart,"imu:",sizeof("imu:"));
    HAL_UART_Transmit_DMA(huart,(uint8_t*) pitch, sizeof(*pitch));
    HAL_UART_Transmit_DMA(huart,",", sizeof(","));
    HAL_UART_Transmit_DMA(huart,(uint8_t*) roll, sizeof(*roll));
    HAL_UART_Transmit_DMA(huart,",", sizeof(","));
    HAL_UART_Transmit_DMA(huart,(uint8_t*) yaw, sizeof(*yaw));
    HAL_UART_Transmit_DMA(huart,"\n", sizeof("\n"));
}